home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- //
- // A very specialized node; this manipulator completely takes care of
- // editing a set of line segments.
- //
-
- #include <Inventor/SbLinear.h>
- #include <Inventor/SbViewportRegion.h>
- #include <Inventor/nodes/SoSeparator.h>
-
- extern class SbColor;
- extern class SbPlaneProjector;
- extern class SbLineProjector;
- extern class SbVec3f;
- extern class SoCoordinate3;
- extern class SoDrawStyle;
- extern class SoHandleEventAction;
- extern class SoLineSet;
- extern class SoLocation2Event;
- extern class SoMaterial;
- extern class SoPath;
- extern class SoPointSet;
- extern class SoSwitch;
- extern class SoTransform;
-
- class LineManip2 : public SoSeparator
- {
- SO_NODE_HEADER(LineManip2);
-
- public:
- LineManip2();
- virtual ~LineManip2();
-
- //
- // Return the coordinates being edited. Put a data sensor on
- // these to get notified whenever they are changed.
- //
- SoCoordinate3 *getCoordinate3();
- void setCoordinate3( SoCoordinate3 *newNode );
-
- //
- // THIS MUST BE CALLED BEFORE THE CLASS IS USED!
- // (SoInteraction::init() calls this for all of the built-in
- // manipulator)
- //
- static void initClass();
-
- //
- // Get rid of any hilights. This can be called when the mouse
- // leaves the window, for example.
- //
- virtual void removeHilights();
-
- //
- // Handle an event. This is meant to be internal only.
- //
- virtual void handleEvent(SoHandleEventAction *);
-
- //
- // Controls how big the feedback is. Default is
- // 0.05.
- //
- virtual void setHilightSize(float);
-
- // Sets the normal to the projection plane.
- void setPlaneNormal( const SbVec3f &newNormal );
-
- SoEXTENDER public:
-
- // Records the viewport size and viewVolume at the time when the
- // manipulator grabs the events.
- // Automatically called by the handleEventAction when this manip
- // grabs events with ha->setGrabber(this)
- // Also turns renderCaching off during the time we are the grabber.
- virtual void grabEventsSetup();
- virtual void grabEventsCleanup();
-
- private:
- SoCoordinate3 *coord, *hilightCoord;
- int current_coord;
- float hilightSize;
- SbVec3f current_position;
- SoPointSet *pset;
- SoDrawStyle *drawStyle;
- SoLineSet *lset;
- SbPlaneProjector *planeProj;
- SbLineProjector *lineProj;
-
- SoTransform *hilightTransform;
- SoMaterial *hilightMaterial;
- SoSwitch *hilightSwitch;
-
- #ifdef __C_PLUS_PLUS_2
- enum LineManipPart {
- #else
- enum Part {
- #endif
- POINTS,
- LINES,
- ENDPOINTS,
- NOTHING,
- };
-
- #ifdef __C_PLUS_PLUS_2
- LineManipPart whichPart();
- #else
- Part whichPart();
- #endif
- SbBool dragStart();
- SbBool remove();
- void updateProjectors( const SbVec3f &curPt );
- void projectMouse(SbVec3f &);
-
- SbBool locateHilight();
- void moveCoord();
- void initHilightStuff();
- void hilightVertex(const SbVec3f &, const SbColor &);
- void hilightLine(int, const SbVec3f &, const SbColor &);
-
- SbVec3f planeNormal;
-
- CacheEnabled savedRenderCachingVal;
- SbViewVolume myViewVolume;
- SbViewportRegion myVpRegion;
- SoHandleEventAction *myHandleEventAction;
- void extractViewingParams( SoHandleEventAction *);
- };
-